package cn.wind.xboot.core.utils;

import com.google.common.util.concurrent.*;

import java.util.concurrent.Callable;
import java.util.concurrent.Executors;

/**
 * <p>Title: ThreadUtil</p>
 * <p>Description: TODO</p>
 *
 * @author xukk
 * @version 1.0
 * @date 2018/7/5
 */
public class ThreadUtil {
    private static ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2));

    public static void submit(Callable callable,FutureCallback futureCallback){
        ListenableFuture<Object> submit = executorService.submit(callable);
        Futures.addCallback(submit, futureCallback);
    }

}
